package com.attendance.controller;

import com.attendance.common.CommonPage;
import com.attendance.common.CommonResult;
import com.attendance.pojo.Class;
import com.attendance.pojo.Pages;
import com.attendance.pojo.Teacher;
import com.attendance.service.ClassService;
import com.attendance.service.StudentService;
import com.attendance.service.TeacherService;
import com.attendance.vo.ClassVO;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/class")
public class ClassController {

    @Autowired
    private ClassService classService;

    //班级列表
    @GetMapping("/select")
    public CommonResult selectClass(ClassVO classVO,Pages page){
        return classService.selectBy(classVO,page);
    }

    //添加班级信息
    @PostMapping(value = "/add")
    public  CommonResult addClass(@RequestBody ClassVO classVO){
        return classService.addClass(classVO);
    }

    //编辑班级信息
    @PutMapping(value = "/update")
    public  CommonResult updateClass(@RequestBody ClassVO classVO){
        return classService.updateClass(classVO);
    }


    //删除班级
    @DeleteMapping(value="/delete")
    public CommonResult delete(ClassVO classVO){
        return classService.deleteClass(classVO);
    }
}


